<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=861217
-->
<head>
  <title>Test for Bug 861217</title>
  <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
</head>
<body onload="runTest()">
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=861217">Mozilla Bug 861217</a>
<p id="display"></p>
<div id="content">
  <table border="0" cellpadding="0" cellspacing="0" style="table-layout: fixed; width: 50px">
    <tbody>
      <tr>
        <td id="tableCell1" style="overflow: hidden"><div style="width: 100px; height: 100px; background-color: DodgerBlue">1</div></td>
      </tr>
      <tr>
        <td id="tableCell2" style="overflow: hidden"><div style="margin-top: 5px; margin-left: 7px; width: 100px; height: 100px; background-color: SkyBlue">2</div></td>
      </tr>
      <tr>
        <td id="tableCell3" style="overflow: hidden"><div style="display: inline-block; margin-right: 8px; margin-bottom: 10px; width: 100px; height: 100px; background-color: Khaki">3</div></td>
      </tr>
      <tr>
        <td id="tableCell4" style="overflow: hidden"><div style="display: inline-block; margin-right: 3px; margin-left: 1px; box-sizing: border-box; width: 100px; height: 100px; border-left: 6px solid black; border-bottom: 2px solid black; background-color: LightCoral">4</div></td>
      </tr>
      <tr>
        <td id="tableCell5" style="overflow: hidden"><div style="display: inline-block; border-right: 9px solid black; width: 100px; height: 100px; background-color: LightSeaGreen">5</div></td>
      </tr>
      <tr>
        <td id="tableCell6" style="overflow: hidden"><div style="box-sizing: border-box; width: 100px; height: 100px; padding-top: 3px; padding-right: 13px; background-color: Orange">6</div></td>
      </tr>
      <tr>
        <td id="tableCell7" style="overflow: hidden"><div style="display: inline-block; margin-right: 11px; margin-left: 4px; box-sizing: border-box; width: 100px; height: 100px; border-right: 6px solid black; border-bottom: 8px solid black; padding-top: 5px; padding-right: 9px; padding-bottom: 8px; padding-left: 7px; background-color: Silver">7</div></td>
      </tr>
      <tr>
        <td id="tableCell8" style="overflow: hidden"><div style="display: inline-block; margin-top: 7px; margin-bottom: 1px; border-right: 6px solid black; border-bottom: 8px solid black; padding-top: 5px; padding-right: 9px; padding-bottom: 8px; padding-left: 7px; width: 100px; height: 100px; background-color: Turquoise">8</div></td>
      </tr>
    </tbody>
  </table>
  <div id="status" style="display: none"></div>
</div>
<pre id="test">
<script class="testbody" type="text/javascript">

SimpleTest.waitForExplicitFinish();

/** Test for Bug 861217 **/
function runTest() {
  var tableCell1 = document.getElementById("tableCell1"),
      bcr1 = tableCell1.getBoundingClientRect(),
      tableCell2 = document.getElementById("tableCell2"),
      bcr2 = tableCell2.getBoundingClientRect(),
      tableCell3 = document.getElementById("tableCell3"),
      bcr3 = tableCell3.getBoundingClientRect(),
      tableCell4 = document.getElementById("tableCell4"),
      bcr4 = tableCell4.getBoundingClientRect(),
      tableCell5 = document.getElementById("tableCell5"),
      bcr5 = tableCell5.getBoundingClientRect(),
      tableCell6 = document.getElementById("tableCell6"),
      bcr6 = tableCell6.getBoundingClientRect(),
      tableCell7 = document.getElementById("tableCell7"),
      bcr7 = tableCell7.getBoundingClientRect(),
      tableCell8 = document.getElementById("tableCell8"),
      bcr8 = tableCell8.getBoundingClientRect();

  is(bcr1.width, 50, "Width of bounding client rect of #tableCell1");
  is(tableCell1.scrollWidth, 100, "scrollWidth of #tableCell1");
  is(bcr1.height, 100, "Height of bounding client rect of #tableCell1");
  is(tableCell1.scrollHeight, 100, "scrollHeight of #tableCell1");

  is(bcr2.width, 50, "Width of bounding client rect of #tableCell2");
  is(tableCell2.scrollWidth, 107, "scrollWidth of #tableCell2");
  is(bcr2.height, 105, "Height of bounding client rect of #tableCell2");
  is(tableCell2.scrollHeight, 105, "scrollHeight of #tableCell2");

  is(bcr3.width, 50, "Width of bounding client rect of #tableCell3");
  is(tableCell3.scrollWidth, 108, "scrollWidth of #tableCell3");
  is(bcr3.height, 110, "Height of bounding client rect of #tableCell3");
  is(tableCell3.scrollHeight, 110, "scrollHeight of #tableCell3");

  is(bcr4.width, 50, "Width of bounding client rect of #tableCell4");
  is(tableCell4.scrollWidth, 104, "scrollWidth of #tableCell4");
  is(bcr4.height, 100, "Height of bounding client rect of #tableCell4");
  is(tableCell4.scrollHeight, 100, "scrollHeight of #tableCell4");

  is(bcr5.width, 50, "Width of bounding client rect of #tableCell5");
  is(tableCell5.scrollWidth, 109, "scrollWidth of #tableCell5");
  is(bcr5.height, 100, "Height of bounding client rect of #tableCell5");
  is(tableCell5.scrollHeight, 100, "scrollHeight of #tableCell5");

  is(bcr6.width, 50, "Width of bounding client rect of #tableCell6");
  is(tableCell6.scrollWidth, 100, "scrollWidth of #tableCell6");
  is(bcr6.height, 100, "Height of bounding client rect of #tableCell6");
  is(tableCell6.scrollHeight, 100, "scrollHeight of #tableCell6");

  is(bcr7.width, 50, "Width of bounding client rect of #tableCell7");
  is(tableCell7.scrollWidth, 115, "scrollWidth of #tableCell7");
  is(bcr7.height, 100, "Height of bounding client rect of #tableCell7");
  is(tableCell7.scrollHeight, 100, "scrollHeight of #tableCell7");

  is(bcr8.width, 50, "Width of bounding client rect of #tableCell8");
  is(tableCell8.scrollWidth, 122, "scrollWidth of #tableCell8");
  is(bcr8.height, 129, "Height of bounding client rect of #tableCell8");
  is(tableCell8.scrollHeight, 129, "scrollHeight of #tableCell8");

  SimpleTest.finish();
}

</script>
</pre>
</body>
</html>
